<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>

</head>
<body class="easyui-layout">
    <div data-options="region:'north'" style="height: 50px">
        <a href="/logout.html">退出</a>
    </div>

    <div data-options="region:'west'" title="菜单" style="width: 10%">
        <ul class="easyui-tree" id="leftMenu">
            <li>
                <span>系统管理</span>
                <ul>
                    <li data-options="url:'/menu/list.html'">
                        <span>菜单管理</span>
                    </li>
                    <li data-options="url:'/role.html?act=page'">
                        <span>角色管理</span>
                    </li>
                    <li data-options="url:'/user.html?act=page'">
                        <span>用户管理</span>
                    </li>
                </ul>
            </li>
        </ul>
    </div>

    <div data-options="region:'center'" title="首页">
        <div id="tabs" class="easyui-tabs"></div>
    </div>
    <script type="text/javascript">
        $(function(){

            $("#leftMenu").tree({
                url:"<%=request.getContextPath()%>/menu.html?act=myTree",
                mathod:"post",
                checkbox:false,
                onClick: function(node){
                    if($("#leftMenu").tree("isLeaf",node.target)){
                        var tabs = $("#tabs");
                        var tab = tabs.tabs("getTab",node.text)
                        if (tab){
                            tabs.tabs("select",node.text);
                        }else{
                            tabs.tabs("add",{
                                title:node.text,
                                href:node.url,
                                closable:true
                            })
                        }
                    }
                }
            })
        })
    </script>
</body>
</html>
